FROM registry.coolgame.world/golang:1.22 AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOPROXY="https://goproxy.cn,direct"
ENV GOPRIVATE="gitlab.coolgame.world"
RUN mkdir -p /www
COPY . /www

WORKDIR /www


RUN git config --add --global url."git@54.255.10.66:".insteadof "http://gitlab.coolgame.world/"

RUN go mod tidy
RUN go mod download && go build -o bin/main
COPY ./etc bin/etc
COPY ./swagger bin/swagger


FROM alpine:latest
COPY --from=builder /www/bin /app
WORKDIR /app
CMD ["./main", "-f", "etc/gitee.com/liuxuezhan/ar-platform/admin-api.yaml"]